﻿using System;
using System.Collections.Generic;
using FlatRedBall;
using FlatRedBall.Math.Geometry;
using Rvz.Game.Main.Collisions;

namespace Rvz.Game.Main.Common
{
    public static class Helper
    {
        //TODO: This probably shouldn't be based on the camera, as the camera might change.
        // Should eventually be map aware of the terrain, maybe the max camera zoom out size or something like that
        public static readonly int TopYCoordinate = Convert.ToInt32(Math.Round(SpriteManager.Camera.RelativeYEdgeAt(0), 0));
        public static readonly int RightXCoordinate = Convert.ToInt32(Math.Round(SpriteManager.Camera.RelativeXEdgeAt(0), 0));
        public static readonly Random Random = new Random();
        public static readonly int MiddleScreenAbsoluteXPosition = SpriteManager.Camera.GetViewport().Bounds.Right - (SpriteManager.Camera.GetViewport().Bounds.Width / 2);
        public static readonly ShapeCollection CameraCollision = new CameraCollisionShapeCollection().Shapes;

        public static void ForEach<T>(this IEnumerable<T> enumerable, Action<T> action)
        {
            foreach (var obj in enumerable)
            { action.Invoke(obj); }
        }
    }
}
